var express = require('express');
var router = express.Router();
var socket = require('../routes/socket');

// chart详情数据
router.get('/data/:id', function(req, res) {
  socket.initSocket();
  console.log('chart详情数据');
  console.log(req.params);
  console.log(req.query);
  console.log(req.body);
  res.json({
    a: 1
  });

  setInterval(function () {
    var data = {
      id: 1,
      name: 'message a'
    };
    console.log(data);
    socket.sendMessage(data);
  }, 1000);
});

module.exports = router;
